package com.sys.midware.redis.util;

import java.nio.charset.Charset;

public class StringRedisSerializer {
    private static final Charset charset = Charset.forName("UTF8");

    // public StringRedisSerializer() {
    // this(Charset.forName("UTF8"));
    // }

    // public static StringRedisSerializer(Charset charset) {
    // Assert.notNull(charset, "Charset must not be null!");
    // StringRedisSerializer.charset = charset;
    // }

    public static String deserialize(byte[] bytes) {
        return (bytes == null ? null : new String(bytes, charset));
    }

    public static byte[] serialize(String string) {
        return (string == null ? null : string.getBytes(charset));
    }
}
